package br.com.regex;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Complexo {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		String regex = "ja[^asdf]*va";
		String index = "012345678901234567890123456";
		String target = "jambo valued jam vacationer";
		Pattern pattern = Pattern.compile(regex);
		Matcher matcher = pattern.matcher(target);
		while (matcher.find()) {
			int startIndex = matcher.start();
			int endIndex = matcher.end();
			int lastIndex = startIndex == endIndex ? endIndex : endIndex - 1;
			String matchedStr = matcher.group();
			System.out.print("(" + startIndex + "," + lastIndex + ":"
					+ matchedStr + ")");
		}
		System.out.println();

	}

}
